package com.example.cms.controller;

import com.example.cms.entity.Questionnaired;
import com.example.cms.entity.Questionnairefile;
import com.example.cms.pojo.Mesagge;
import com.example.cms.service.QuestionnairedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName QuestionTitleItemContorller
 * @Descriptiom TODO
 * @Author Sunbird
 * @Date 2018/12/21 11:18
 * @Version 1.0
 **/
@RestController
public class QuestionTitleItemContorller {
    @Autowired
    private QuestionnairedService questionnairedService;
    /**
     * @Author Sunbird
     * @Description 查询所有的表
     * @Date  2018/12/18
     * @Param
     * @return
     **/
    @RequestMapping("naired")
    public List QuestionNaired(){
        List<Questionnaired> list= questionnairedService.getAllQues();
        return list;
    }
    /**
     * @Author Sunbird
     * @Description 根据id查询题目
     * @Date  2018/12/19
     * @Param
     * @return
     **/
    @RequestMapping("nairedById")
    public List<Questionnaired> SelectQuestionNairde(Integer questionNairedid){
        List<Questionnaired> list =questionnairedService.findeQuestionNaireId(questionNairedid);
        return  list;
    }
    /**
     * @Author Sunbird
     * @Description 删除问卷信息
     * @Date  2018/12/20
     * @Param
     * @return
     **/
    @RequestMapping("deletQuestion")
    public Mesagge deletQuestionNaired(Integer QuestionNairedId ,Mesagge mesagge){
        return questionnairedService.deletQuestionNaired(QuestionNairedId);
    }
    /**
     * @Author Sunbird
     * @Description 新增试卷
     * @Date  2018/12/20
     * @Param
     * @return
     **/
    @RequestMapping("insertQuest")
    public Mesagge insertQuestionNaired(@ModelAttribute  Questionnaired questionnaired, Mesagge mesagge){
        questionnairedService.insertQuestionNaired(questionnaired,mesagge);
        return mesagge;
    }
    @RequestMapping("insertQuestTitle")
    public Mesagge insertQuestTitle(Questionnairefile questionnairefile, Mesagge mesagge){

        return mesagge;
    }


    @RequestMapping("selectQuestionName")
    public List selectQuestionName(String questionName){
        return questionnairedService.selectQuestionName(questionName);
    }
}
